package com.jqq.map_;

import java.util.Hashtable;

/**
 * @author 姬倩倩
 * @version 1.0
 */
@SuppressWarnings({"all"})
public class Hashtable_ {
    public static void main(String[] args) {
        Hashtable table = new Hashtable();//初始化Hashtable$Entry[11]
        //临界值threshold=11*0.75=8
        table.put("john", 100);
        table.put("lucy", 100);
        table.put("lucy", 88);
        for (int i = 1; i < 8; i++) {
            table.put("hello"+i, 1);
        }
        //超过临界8，就会扩容2*11 + 1 = 23 新的临界值23*0.75 = 17
        //addEntry(hash, key, value, index);添加k-v封装到entry
        //if (count >= threshold)满足时，进行扩容
        //按照int newCapacity = (oldCapacity << 1) + 1;进行扩容



//        table.put(null,100);//NullPointerException
//        table.put(100,null);//NullPointerException
    }
}
